package br.net.woodstock.tickettoride.spring.web;

import br.net.woodstock.rockframework.web.struts2.AbstractAction;
import br.net.woodstock.rockframework.web.struts2.util.AroundAction;
import br.net.woodstock.tickettoride.orm.User;
import br.net.woodstock.tickettoride.struts2.web.security.SecurityUtils;

public abstract class AbstractApplicationAction extends AbstractAction implements AroundAction {

	private static final long	serialVersionUID	= -6506029852228715125L;

	public static final String	MSG_BUNDLE			= "messages";

	public static final String	MSG_OPERATION_OK	= "msg.operation.ok";

	public static final String	MSG_OPERATION_ERROR	= "msg.operation.error";

	@Override
	public void before() throws Exception {
		//
	}

	@Override
	public void after() throws Exception {
		//
	}

	public User getUser() {
		return SecurityUtils.getSessionUser();
	}

	protected String getMessage(final String key) {
		return this.getText(key);
	}

	protected String getMessageOperationOK() {
		return this.getText(AbstractApplicationAction.MSG_OPERATION_OK);
	}

	protected String getMessageOperationError() {
		return this.getText(AbstractApplicationAction.MSG_OPERATION_ERROR);
	}

}
